package free.emaranhado.casadolago.adapter;

import java.util.ArrayList;

import free.emaranhado.casadolago.R;
import free.emaranhado.casadolago.model.Category;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class CategoryAdapter extends BaseAdapter {
    private Context mContext;

    private ArrayList<String> mImageIds = new ArrayList<String>();
    
    public void addCategory(Category mCategory){
    	mImageIds.add(mCategory.getName());
    	Log.i("NamesCat", "= "+mImageIds);
    }
   

    public CategoryAdapter(Context c) {
        mContext = c;
    }

    public int getCount() {
        return mImageIds.size();
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
    	
    	LayoutInflater inflater = (LayoutInflater) mContext.getSystemService
        (Context.LAYOUT_INFLATER_SERVICE);
    	RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.category_item_view, parent, false);

    	
        TextView i = (TextView) view.findViewById(R.id.category_name);
        i.setText(mImageIds.get(position));

        return view;
    }
    
}